<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <meta name="format-detection"content="telephone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" /><!-- 删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" /><!-- 设置苹果工具栏颜色 -->
    <meta name="renderer" content="ie-comp">
    <meta name=”renderer” content=”ie-stand”>
    <meta name="renderer" content="webkit"> 
    <meta name="keywords" content="耀盛中国,耀盛智投,理财产品,智选财富,耀盛智投官网"/>
    <meta name="description" content="耀盛智投为耀盛中国旗下理财产品智选平台。专注于为大众富裕阶层、精英个人、中产阶级家庭、合规机构等提供定制化资产配置咨询推荐服务，帮助客户实现财富的增值。" />
    <title>忘记密码</title>
    <script src="../../lib/js/ftSize.js"></script>
    <link rel="stylesheet" href="../../lib/css/_base.css">
    <link rel="stylesheet" href="../../lib/css/publicBubb.css">
    <link rel="stylesheet" type="text/css" href="../../lib/css/forgotPassword.css">
</head>
<body>
    <!-- 验证手机号 -->
    <div class="forgot_one" id="floginOne">
        <div class="forgot">
            <h1>验证手机号</h1>
            <div class="F_padding">
                <div class="F_one F_bottom">
                    <input type="text" name="" placeholder="请输入手机号码" id="forgetmMblie" maxlength="11"/>
                </div>
                <div class="F_yzm">
                    <input type="text" name="" placeholder="请输入短信验证码" class="yzm" id="forgetmSms" maxlength="6">
                    <span id="getSms" onClick="getMess()">获取验证码</span>
                </div>
            </div>    
        </div>
        <div class="wraning1"></div>
        <div class="F_btn_n1" id="fpwdOne" onClick="lossOne()">下一步</div>
    </div>
    <!-- 验证身份证 -->
    <div class="forgot_tree" id="floginTwo">
        <div class="forgot">
            <h1>验证身份证</h1>
            <div class="F_padding F_bottom">
                <div class="F_one" style="border-bottom:1px solid #ededed;">
                    <input type="text" name="" placeholder="请输入真实姓名" id="forgetmName">
                </div>
                <div class="F_one">
                    <input type="text" name="" placeholder="请输入身份证号" id="forgetmCard">
                </div>
            </div> 
        </div>
        <div class="wraning3"></div>
        <div class="F_btn_n1" id="fpwdThree"  onClick="lossTwo()">下一步</div>
    </div>
    <!-- 设置新密码 -->
    <div class="forgot_tow" id="floginThree">
            <div class="forgot">
                <h1>设置新密码</h1>
                <div class="F_padding">
                    <div class="F_one F_bottom">
                        <input type="password" name="" placeholder="请输入新密码" id="forgetmNpwd">
                    </div>
                    <div class="F_one">
                        <input type="password" name="" placeholder="请确认新密码" id="forgetmOpwd">
                    </div>
                </div>
            </div>
            <div class="wraning2"></div>
            <div class="F_btn_n1" id="fpwdTwo" onClick="lossThree()">下一步</div>
    </div>
    <!-- 弹窗 -->
    <div class="maskWrap" id="forgetMask">
        <div class="maskLayer">
            <div class="maskImg"></div>
            <div class="maskTitle">密码成功</div>
            <div class="maskContent"></div>
            <div class="maskbtnGroup">
                <a href="../login.html"> <span class="winBg"> 立即登录</span></a>
                <a href="../../home/index.html"><span> 返回首页</span></a>
            </div>  
        </div>
    </div>
<script src="../../lib/js/jquery.min.js"></script>
<script src="../../lib/js/public-header.js"></script>
<script>
    var validCode=true;
    var isRegister;
    var messError;
$('#forgetmMblie').focus(function(){
    $('.wraning1').text('')
})
$('#forgetmSms').focus(function(){
    $('.wraning1').text('')
})
$('#forgetmOpwd').focus(function(){
    $('.wraning2').text('')
})
$('#forgetmNpwd').focus(function(){
    $('.wraning2').text('')
})
$('#forgetmName').focus(function(){
    $('.wraning3').text('')
})
$('#forgetmCard').focus(function(){
    $('.wraning3').text('')
})
$('#forgetMask').hide()
/* 注册信息 */
function isRegistJson(mobile) {
    var json = {
        "faceCode":"user/registerCheck",
        "token":"",
        "clientInfo":"W,100,IE8",
        "requestTime": formatDateTime(startTime),
        "body":{
            "mobile":mobile,
            "flag":"1"
        }
    }
    return json;
}
/* 第一步验证信息 */
function fpwdOne(mobile,smsCode,uname,certNo,loginPwd,newLoginPwd,resetFalg) {
    var json = {
        "faceCode":"user/forgetPwd",
        "token":"",
        "clientInfo":"W,100,IE8",
        "requestTime": formatDateTime(startTime),
        "body":{
            "mobile":mobile,
            "smsCode":smsCode,
            "username":uname,
            "certNo":certNo,
            "loginPwd":loginPwd,
            "newLoginPwd":newLoginPwd,
            "resetFalg":resetFalg
        }
    }
    return json;
}

/* 判断是否注册 */
function isRegistered(registerMobile){
    $.ajax({  
        type: "POST",
        url: httpServer+"user/registerCheck",
        headers:{
            'Access-Control-Allow-Origin':'*'
        }, 
        async:false,
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(isRegistJson(registerMobile)),
        dataType: "json",
        success: function (isMobile) {  
            isRegister=isMobile 
        },
        error: function(error){  
            console.log(error,1);  
        }    
    }); 
}

function smsJson(mobile) {
    var json = {
        "faceCode":"common/sendSms",
        "token":"",    
        "clientInfo":"W,100,IE8",  
        "requestTime": formatDateTime(startTime),
        "body":{
            "mobile":mobile,
        }
     }
    return json;
}
/* 获取短信验证码 */

function getMess(){
    let forgetmMblie=$('#forgetmMblie').val().trim();
    if(forgetmMblie!=''){
        if(startPhone.test(forgetmMblie) ){
            isRegistered(forgetmMblie)
            if(isRegister.resCode!='0'){
                $('.wraning1').text(isRegister.errorMsg)
            }else{
                    var time=60;
                    var $code=$(this);
                    if (validCode) {
                    validCode=false;
                    var t=setInterval(function  () {
                        time--;
                        $('#getSms').html(time+"秒");
                        if (time==0) {
                            clearInterval(t);
                            $('#getSms').html("获取验证码");
                            validCode=true;
                        }
                    },1000)
                }
                $.ajax({  
                type: "POST",
                url: httpServer+"common/sendSms",
                headers:{
                    'Access-Control-Allow-Origin':'*'
                }, 
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify(smsJson(forgetmMblie)),
                dataType: "json",
                success: function (ismessAuth) {  
                    if(ismessAuth.resCode!='0'){
                        $('.wraning1').text(ismessAuth.errorMsg)
                    }else{
                       
                    }
                },
                error: function(error){  
                
                }    
            }); 
                
               
                //messAuth(forgetmMblie)
            }
        }else{
            $('.wraning1').text('请输入11位正确格式的手机号')
        }
    }else{
        $('.wraning1').text('请先输入手机号码')
    }
}


/* 忘记密码第一步 判断是否实名认证 手机号/短信验证码*/
function lossOne(){
    let forgetmMblie=$('#forgetmMblie').val().trim();
    let forgetmSms=$('#forgetmSms').val().trim();
    if(forgetmMblie!=''){
        if(startPhone.test(forgetmMblie)){
            if(forgetmSms!=''){
                $.ajax({  
                    type: "POST",
                    url: httpServer+"user/forgetPwd",
                    headers:{
                        'Access-Control-Allow-Origin':'*'
                    }, 
                    async:false,
                    contentType: "application/json; charset=utf-8",
                    data: JSON.stringify(fpwdOne(forgetmMblie,forgetmSms,'','','','','1')),
                    dataType: "json",
                    success: function (isMobile) {  
                        if(isMobile.resCode!='0' ){
                            $('.wraning1').text(isMobile.errorMsg)
                        }else{//1认证
                            if(isMobile.body.certFlag=='1'){
                                $('#floginOne').hide();
                                $('#floginTwo').show();
                                $('#floginThree').hide();
                            }else{
                                $('#floginOne').hide();
                                $('#floginThree').show();
                                $('#floginTwo').hide();
                            }
                        }
                    },
                    error: function(error){  
                        console.log(error,1);  
                    }    
                }); 
            }else{
                $('.wraning1').text('验证码不能为空!')
            }
        }else{
            $('.wraning1').text('手机号码格式有误')
        }
    }else{
        $('.wraning1').text('手机号码不能为空')
    }
} 
/* 忘记密码第二步 身份证/姓名*/
function lossTwo(){
    let forgetmMblie=$('#forgetmMblie').val().trim();
    let forgetmSms=$('#forgetmSms').val().trim();
    let forgetmName=$('#forgetmName').val().trim();
    let forgetmCard=$('#forgetmCard').val().trim();
   
    if(forgetmName!=''){
        if(horseName.test(forgetmName)){
            if(forgetmCard.length==18){
                if(cardOne.test(forgetmCard)){
                    $.ajax({  
                        type: "POST",
                        url: httpServer+"user/forgetPwd",
                        headers:{
                            'Access-Control-Allow-Origin':'*'
                        }, 
                        async:false,
                        contentType: "application/json; charset=utf-8",
                        data: JSON.stringify(fpwdOne(forgetmMblie,forgetmSms,forgetmName,forgetmCard,'','','2')),
                        dataType: "json",
                        success: function (isMobile) {  
                            if(isMobile.resCode!='0'){
                                $('.wraning3').text(isMobile.errorMsg)
                            }else{
                                $('#floginOne').hide();
                                $('#floginTwo').show();
                                $('#floginThree').hide();
                            }
                           /*  $('.forgot_one').hide()
                            $('.forgot_tow').show()
                            $('.forgot_tree').hide() */
                            
                        },
                        error: function(error){  
                            console.log(error,2);  
                        }    
                    }); 
                }else{
                    $('.wraning3').text('请输入正确身份证号码！')
                }
            }else if(forgetmCard.length==15){
                if(cardTwo.test(forgetmCard)){
                    $.ajax({  
                        type: "POST",
                        url: httpServer+"user/forgetPwd",
                        headers:{
                            'Access-Control-Allow-Origin':'*'
                        }, 
                        async:false,
                        contentType: "application/json; charset=utf-8",
                        data: JSON.stringify(fpwdOne(forgetmMblie,forgetmSms,forgetmName,forgetmCard,'','','2')),
                        dataType: "json",
                        success: function (isMobile) {  
                            if(isMobile.resCode!='0' ){
                                $('.wraning3').text(isMobile.errorMsg)
                            }else{ 
                                    $('#floginOne').hide();
                                    $('#floginTwo').hide();
                                    $('#floginThree').show();
                                    
                            }
                        },
                        error: function(error){  
                            console.log(error,1);  
                        }    
                    }); 
                }else{
                    $('.wraning3').text('请输入正确身份证号码！')
                }
            }else{
                $('.wraning3').text('身份证号码不能为空')
            }
        }else{
            $('.wraning3').text('姓名格式有误')
        }
    }else{
        $('.wraning3').text('姓名不能为空')
    }
} 

/* 忘记密码第三步 新密码/确认密码*/
function lossThree(){
    let forgetmMblie=$('#forgetmMblie').val().trim();
    let forgetmSms=$('#forgetmSms').val().trim();
    let forgetmName=$('#forgetmName').val().trim();
    let forgetmCard=$('#forgetmCard').val().trim();
    let forgetmOpwd=$('#forgetmOpwd').val().trim();
    let forgetmNpwd=$('#forgetmNpwd').val().trim();
    if(forgetmOpwd!=''){
        if(payPwd.test(forgetmOpwd)){
            if(forgetmNpwd!=''&&payPwd.test(forgetmNpwd)){
                $.ajax({  
                    type: "POST",
                    url: httpServer+"user/forgetPwd",
                    headers:{
                        'Access-Control-Allow-Origin':'*'
                    }, 
                    async:false,
                    contentType: "application/json; charset=utf-8",
                    data: JSON.stringify(fpwdOne(forgetmMblie,forgetmSms,forgetmName,forgetmCard,forgetmOpwd,forgetmNpwd,'3')),
                    dataType: "json",
                    success: function (isMobile) {  
                       if(isMobile.resCode!='0' ){
                        $('.wraning2').text(isMobile.errorMsg)
                       }else{ 
                            $('#forgetMask').show()
                       }
                    },
                    error: function(error){  
                        console.log(error,3);  
                    }    
                }); 
            }else{
                $('.wraning2').text('请输入6~16位字母数字组合新密码!')
            }
        }else{
            $('.wraning2').text('请输入6~16位字母数字组合新密码!')
        }
    }else{
        $('.wraning2').text('请输入6~16位字母数字组合新密码!')
    }
}  
</script>

</body>
</html>